<%@ page language="java" import="java.util.*" pageEncoding="utf-8" %>
<%@ include file="/WEB-INF/taglib.jsp" %>
<%@ include file="/WEB-INF/jsp/include.jsp" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
    <title>修改密码</title>
    <script type="text/javascript">

        function submit_Modify() {
            var newPwd = $('#newPwd').val();
            var newPwd1 = $('#newPwd1').val();
            if (newPwd != newPwd1) {
                $.messager.alert("操作提示", "两次密码输入不一致！", "info");
                return;
            }
            //校验纳税人识别号
            if (!((6 <= newPwd.length) && (newPwd.length <= 10))) {
                $.messager.alert("操作提示", "密码长度需要大于6位！", "info");
                return;
            }
            var param = new Object();
            param.newPassword = $('#newPwd').val();
            $.ajax({
                type: "POST",
                url: '${path}/system/register/modifyPassword',
                data: param,
                dataType: "json",
                async: false,
                success: function callback(data) {
                    if (data.code != "0000") {
                        if (data.code == "9999") {
                            $.messager.alert("操作提示", data.msg, "warning", function () {
                                var top = window;
                                while (top != top.parent) {
                                    top = top.parent;
                                }
                                top.location.href = "/system/register/toLogin"; //跳转到登陆页面
                            });
                        } else {
                            $.messager.alert("操作提示", data.msg, "info", function () {
                                var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
                                parent.layer.close(index);
                            });
                        }
                    } else {
                        $.messager.alert('操作提示', data.msg, 'info', function () {
                            var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
                            parent.layer.close(index);
                        });
                    }
                },
                error: function (data, textstatus) {
                    $.messager.alert('操作提示', data.responseText, 'error', function () {
                    });
                }
            });
        }
    </script>
</head>

<body style="margin:0px; padding:0px;">
<%@ include file="/WEB-INF/jsp/loading.jsp" %>
<!--修改密码窗口-->
<div class="easyui-layout" fit="true">
    <div id="ModifyDlgDiv" align="center" style="margin-top: 30px;">
        <form id="pwdForm" method="post">
            <table cellpadding=3>
                <tr>
                    <td>新密码：</td>
                    <td><input id="newPwd" type="password" name="newPwd" class="txt01"
                               onfocus="this.select();"
                               onKeyPress="javascript:return moveFocus(event,'txtRePass')" maxlength="10"
                    <%--只能输入英文、数字、@符号和.符号--%>
                               onkeyup="value=value.replace(/[^\a-\z\A-\Z0-9\@\.]/g,'')"/></td>
                </tr>
                <tr>
                    <td>确认密码：</td>
                    <td><input id="newPwd1" type="password" name="newPwd1" class="txt01"
                               onfocus="this.select();"
                               onKeyPress="javascript:return moveFocus(event,'btnEp')" maxlength="10"
                    <%--只能输入英文、数字、@符号和.符号--%>
                               onkeyup="value=value.replace(/[^\a-\z\A-\Z0-9\@\.]/g,'')"/></td>
                </tr>
            </table>
        </form>
    </div>
    <div align="center" style="margin-top: 20px;">
        <a class="easyui-linkbutton" iconcls="icon-ok" onclick="submit_Modify()">确定</a>
        <a class="easyui-linkbutton" iconcls="icon-cancel" onclick="closeLayer();">取消</a>
    </div>
</div>

</body>
</html>
